<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>新增数组元素</title>
    <script>
        // 1、修改length长度
        var arr = [1, 2, 3];
        //arr.length = 5; // 手动把数组长度修改为5
        // 2、通过索引号修改数组元素
        arr[3] = 4;
        arr[4] = 5;
        console.log(arr);
    </script>
</head>

<body>

</body>

</html>